-- stored procedures for pku talk.net

go
create procedure mostpro as
select top(20) * from(
	select Users.UserID, Username, cast(sum(nPro) as real)/nMessage as Rate
	from Messages, Users
	where Users.UserID = Messages.UserID
	group by Users.UserID, Username, nMessage
	) as Temp
order by Rate desc
go
create procedure mostcon as
select top(20) * from(
	select Users.UserID, Username, cast(sum(nCon) as real)/nMessage as Rate
	from Messages, Users
	where Users.UserID = Messages.UserID
	group by Users.UserID, Username, nMessage
	) as Temp
order by Rate desc
go